//
//  WCContactCell.m
//  CBT
//
//  Created by apple on 2019/7/8.
//  Copyright © 2019 Mr.Zhang. All rights reserved.
//

#import "WCContactCell.h"

@implementation WCContactCell

+ (instancetype)createTableView:(UITableView *)tableView {
    WCContactCell *cell = [tableView dequeueReusableCellWithIdentifier:@"contactcell"];
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.backgroundColor = [UIColor colorWithRed:237/255.0 green:237/255.0 blue:237/255.0 alpha:1];
    [cell makeViews];
    
    return cell;
}

- (void)makeViews {
    
    CGFloat width = (SCREEN_WIDTH-30);
    
    UIView *bgview = [[UIView alloc] init];
    bgview.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:bgview];
    [bgview mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(0);
        make.top.mas_equalTo(14);
        make.height.mas_equalTo(276);
        make.width.mas_equalTo(width);
    }];
    bgview.layer.cornerRadius = 5.0;
    
    [bgview addSubview:self.scanCodeImg];
    [self.scanCodeImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(26);
        make.centerX.mas_equalTo(0);
        make.width.height.mas_equalTo(135);
    }];
    
    [bgview addSubview:self.nameLabel];
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.scanCodeImg.mas_bottom).offset(13);
        make.centerX.mas_equalTo(0);
        make.width.mas_equalTo(width);
    }];
    
    [bgview addSubview:self.copBtn];
    [self.copBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.mas_equalTo(bgview.mas_bottom).mas_offset(-25);
        make.height.mas_equalTo(44);
        make.left.mas_equalTo(33);
        make.right.mas_equalTo(-33);
    }];
}


- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.textColor = UIColorFromRGB(0x333333);
        _nameLabel.font = [UIFont systemFontOfSize:15];
        _nameLabel.text = @"facebook";
        _nameLabel.textAlignment = NSTextAlignmentCenter;
    }
    
    return _nameLabel;
}

- (UIButton *)copBtn {
    if (!_copBtn) {
        _copBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_copBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [_copBtn setTitle:kLocalizedString(@"保存二维码",nil) forState:UIControlStateNormal];
        _copBtn.titleLabel.font = [UIFont systemFontOfSize:18];
        _copBtn.backgroundColor = UIColorFromRGB(0xFF5101);
        _copBtn.layer.cornerRadius = 5;
    }
    
    return _copBtn;
}

- (UIImageView *)scanCodeImg {
    if (!_scanCodeImg) {
        _scanCodeImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"wechat"]];
        _scanCodeImg.backgroundColor = [UIColor lightGrayColor];
        
    }
    
    return _scanCodeImg;
}



@end
